import layout from "./layout/layout.vue";

import {
	stringObject
} from '@/y-ui/utils/api.js';

// import * as http from "@/utils/request.js";
import yForm from "@/y-ui/y-form/y-form";
export default {
	components: {
		layout,
		yForm
	},
	onLoad(e) {
		this.parameter = e;
		//取详情 - 显示页
		this.get();
	},
	data() {
		return {
			/**
			 * 表单缓存 false 即不缓存
			 */
			formCache: {},
			/**
			 * 表单数据对象
			 */
			info: {
				
			}
		}
	},
	methods: {
		/**
		 * 获取流程详情
		 */
		async get() {
			// const res = await get({
			// 	id
			// });
		},
		/**
		 * 选择按钮
		 */
		opt(h, obj, click = function() {}) {
			return h(yButton, {
				props: {
					size: 'small'
				},
				style: {
					marginLeft: "1em"
				},
				on: {
					click
				}
			}, "选择");
		},
		//提交表单
		async submitForm(e, data) {
			if (!e) return uni.showToast({
				title: "表单填写有误，请仔细填写",
				icon: "none",
				duration: 2000
			});
			// add({...data}).then(res => {
			// 	uni.showToast({
			// 		title: '提交成功',
			// 		icon: "success",
			// 		duration: 1000
			// 	});
			// }).catch(error => {
			// 	uni.showModal({
			// 		title: "错误",
			// 		content: error.message || "网络不通",
			// 		showCancel: !1
			// 	});
			// });
		}
	}
}
